package mya.mes.mdc.local.mongodb;

import com.alibaba.fastjson.JSONObject;
import mya.mes.mdc.model.alarm.Alarm;
import org.bson.Document;

import java.util.List;
import java.util.Map;

public interface MongoDbService {

    public void saveMdcData(Document doc) throws Exception;

    public List<Document> queryMdcData(List<FilterDto> filterDtoList, String sortPropery) throws Exception;

    /**
     * 查询含有指定tag的数据
     *
     * @param tagNoList
     * @param sortProperty
     * @return
     * @throws Exception
     */
    public List<Document> queryTagData(List<String> tagNoList, List<FilterDto> dtoList, String sortProperty) throws Exception;

    /**
     * 根据集合名删除
     * @param collectionName
     */
    public boolean deleteCollection(String collectionName);

    /**
     * 往指定的集合里添加数据
     * @param collectionName
     * @param docs
     */
    public void saveByCollectionName(String collectionName, List<JSONObject> docs);


    List<Document> queryMdcTag(String collectionName);

    /**
     * 保存mqtt接收到的数据
     * @param jsonObject
     */
    public JSONObject saveMqttReceivedMsg(JSONObject jsonObject);

    public void updateAlarmCurrent(List<JSONObject> startList, List<JSONObject> stopList);

    public void updateAlarmCurrentData(List<Alarm> weixinSentList, List<Alarm> managerList);

    public void updateAlarm(List<JSONObject> startList, List<JSONObject> stopList);

    public Document queryDocumentById(String collectionName, String _id);

    public void updateAlarmCollNo(JSONObject jsonObject);

    public Map queryPage(String collectionName, int page, int limit, List<FilterDto> filterDtoList, String sortPropery);

    public void replace();

    public void delete();

    void saveSendData(String collectionName,JSONObject jsonObject);

    void updateAlarmData(List<Alarm> weixinSentList, List<Alarm> managerList);

    void deleteById(String collectionName,List<Alarm> stopList);
}
